﻿using System;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var eventType = typeof(string);

            var targetType = typeof(ILocalEventHandler<>).MakeGenericType(eventType);
            var method = targetType.GetMethod(
                nameof(ILocalEventHandler<object>.HandleEventAsync),
                new[] {eventType}
            );

            var actionHandler = new ActionEventHandler<string>(str => { Console.WriteLine(str); });
            method.Invoke(actionHandler, new[] {"Event Data"});

            Console.ReadLine();
        }
    }
}